<route lang="json5">
{
  style: {
    navigationStyle: 'custom',
    navigationBarTitleText: '约会详情',
  },
}
</route>

<template>
  <view style="position: relative;">
    <view class="w-750rpx m-a">
      <wd-notice-bar 
        text="在了解对方之前，不要透露过多个人信息，包括地址、电话号码等敏感信息。任何要求提供验证码或借钱的行为都可能是骗局，务必保持警惕‌"
        :color="themeConfig.theme === 'dark' ? '#fff': '#1B1116'"
        background-color="rgba(255, 255, 255, 0)"
      >
        <template #prefix>
          <view class="w-32rpx h-32rpx font-size-0 pr-16rpx">
            <wd-img 
              width="100%" 
              height="100%" 
              :src="tips" 
              mode="aspectFill" 
            />
          </view>
        </template>
      </wd-notice-bar>
    </view>

    <!-- 轮播图 -->
    <my-swiper :list="loveDetail.fileInfoVoList" imageMode="aspectFill" />

    <view class="w-center pt-14rpx font-size-32rpx font-600 pb-24rpx relative">
      约会主题：{{ loveDetail.datingTheme || '--' }}
    </view>
    
    <!-- 悬浮按钮列表 -->
    <view class="fixed right-32rpx top-886rpx w-80rpx h-80rpx flex-sb flex-col flex-wrap">
      <!-- 转发 -->
      <view class="btn-sd bg-linear-1 w-80rpx h-80rpx flex-center rounded-full color-white relative flex-wrap">
        <wd-button custom-class="share-btn" open-type="share">分享</wd-button>
        <view class="w-80rpx flex-center">
          <i class="iconfont icon-fenxiang font-size-36rpx"></i>
        </view>
        <text class="inline-block font-size-20rpx mt--16rpx">分享</text>
      </view>
    </view>
    
    <view class="w-center pb-10rpx">
      <view 
        class="w-150rpx px-16rpx rounded-full bg-#FFDDD0 btn-h-42 leading-0 flex-center color-#4D4D4D font-600"
        v-if="loveDetail.registered == '2'"
      >已应约成功</view>
    </view>

    <view class="w-center color-#666 font-size-28rpx pb-10rpx">
      约会开始时间：{{ formatDate(new Date(loveDetail.startTime)) || '--' }}
    </view>

    <view class="w-center color-#666 font-size-28rpx pb-10rpx">
      预计结束时间：{{ formatDate(new Date(loveDetail.endTime)) || '--' }}
    </view>

    <view class="w-center color-#666 font-size-28rpx pb-10rpx">
      约会区域：
      <text v-if="loveDetail.provinceName === loveDetail.cityName">{{ loveDetail.cityName }}{{ loveDetail.districtName }}</text>
      <text v-else>{{ loveDetail.provinceName }}{{ loveDetail.cityName }}{{ loveDetail.districtName }}</text>
    </view>
    
    <view class="w-center color-#666 font-size-28rpx pb-10rpx">
      详细地址：{{ loveDetail.location }}
    </view>
    
    <view class="w-center color-#666 font-size-28rpx pb-32rpx">
      约会内容：{{ loveDetail.content || '--' }}
    </view>
    
    <!-- <view class="w-750rpx m-a flex-sb pl-80rpx pr-32rpx pt-16rpx pb-16rpx relative box-border">
      <view class="text-center">
        <base-img-box :size="144" :round="144" :imgSrc="loveDetail.personAvatar && loveDetail.personAvatar.preUrl" />
      </view>
      <view class="w-470rpx pt-8rpx">
        <view class="ellipsis">
          <text class="font-size-30rpx font-bold leading-33rpx" @click="toUserDetail(loveDetail.userId)">
            {{ loveDetail.userProfileInfoVo.nickname || '--' }}
          </text>
          <text class="font-size-24rpx leading-28rpx ml-22rpx">ID：{{ loveDetail.code || '--' }}</text>
        </view>
        <view class="mt-16rpx color-#666 font-size-24rpx leading-26rpx">
          <wd-text 
            :text="`${loveDetail.userProfileInfoVo.gender == '0' ? '男' : '女'}·`" 
            size="28rpx" 
            color="#666"
          ></wd-text>
          <wd-text 
            :text="`${calculateAge(loveDetail.userProfileInfoVo.birthYearMonth)}岁`" 
            size="28rpx" 
            color="#666"
          ></wd-text>
          <wd-text 
            v-if="loveDetail.userProfileInfoVo.height"
            :text="`·${loveDetail.userProfileInfoVo.height}cm`" 
            size="28rpx" 
            color="#666"
          ></wd-text>
        </view>
        <view class="mt-10rpx">
          <view class="color-#666 font-size-24rpx flex-a-center">
            <i class="iconfont icon-dingwei font-size-26rpx mr-6rpx"></i>
            <text class="inline-block ellipsis">{{ loveDetail.provinceName }}{{ loveDetail.cityName }}{{ loveDetail.districtName }}</text>
          </view>
          <view class="color-#666 font-size-24rpx mt-10rpx">
            约会开始时间:
            <text class="ellipsis">{{ formatDate(new Date(loveDetail.startTime)) || '--' }}</text>
          </view>
          <view class="color-#666 font-size-24rpx mt-10rpx">
            预计结束时间:
            <text class="ellipsis">{{ formatDate(new Date(loveDetail.endTime)) || '--' }}</text>
          </view>
        </view>
      </view>
    </view> -->

    <view class="w-750rpx m-a" v-if="loveDetail.userId === user.userInfo.id">
      <view class="w-center py-20rpx font-900">
        应约嘉宾
      </view>
      <view class="border-1px"></view>
      
      <!-- 没有数据 -->
      <view v-if="!datingRegistrationInfoVos.length" class="color-#999 font-size-26rpx py-48rpx text-center">
        暂无应约嘉宾
      </view>

      <template v-for="item in datingRegistrationInfoVos">
        <view class="w-center flex py-24rpx" style="justify-content: space-between;">
          <base-img-box :size="96" :round="96" :imgSrc="getInfo(item).preUrl" :thumbnailPreUrl="getInfo(item).thumbnailPreUrl" />
          <view class="pl-24rpx" style="flex: 1;">
            <view class="flex-sb-center">
              <view class="font-size-32rpx font-900 max-w-150rpx ellipsis" @click="toUserDetail(getInfo(item).userId)">
                {{ getInfo(item).nickname }}
              </view>
              <view class="font-size-24rpx color-#666 max-w-250rpx ellipsis">
                {{ `${getInfo(item).gender == '0' ? '男' : '女'}` }}·{{ calculateAge(getInfo(item).birthYearMonth) }}岁·{{ getInfo(item).professionName }}
              </view>
            </view>
            <view class="flex-sb-center font-size-24rpx">
              <view class="color-#666">
                ID: {{ getInfo(item).code }}
              </view>
              <view class="color-#666 max-w-280rpx ellipsis">{{ getInfo(item).areaName }}</view>
            </view>
            <view class="flex mt-6rpx" style="align-items: center;justify-content: flex-start;">
              <view 
                @click="toUserDetail(getInfo(item).userId)"
                class="w-150rpx px-20rpx rounded-full btn-bg-gra btn-h-42 leading-0 flex-center color-white font-600"
              >了解应约者</view>
              <view 
                v-if="loveDetail.status == 0 && !loveDetail.sureFlag"
                @click="sureDatingConfirm(getInfo(item).userId)"
                class="w-150rpx px-20rpx rounded-full btn-bg-gra btn-h-42 leading-0 flex-center color-white font-600"
                style="margin-left: 12rpx !important;"
              >接受邀约</view>
              <view 
                v-if="getInfo(item).status == '2'"
                class="w-150rpx px-20rpx rounded-full btn-bg-gra btn-h-42 leading-0 flex-center color-white font-600"
                style="margin-left: 12rpx !important;"
              >已接受邀约</view>
            </view>
          </view>
        </view>
        
        <view class="border-1px"></view>
      </template>
    </view>

    <template v-else>
      <!-- 私聊/拨打电话 -->
      <view class="w-center flex-sb-center pt-22rpx"
        v-if="loveDetail.registered"
      >
        <view class="btn-full-r16 w-252rpx">
          <wd-button 
            class="btn-w-full btn-h-78"
            @click="openConversationList"
          >私聊</wd-button>
        </view>
        <!-- <view class="btn-full-r16 w-420rpx">
          <wd-button 
            class="btn-w-full btn-h-78"
            @click="getBindPhoneUserId"
          >虚拟拨号</wd-button>
        </view> -->
        <view class="btn-full-r16 w-420rpx">
          <wd-button 
            class="btn-w-full btn-h-78"
            @click="getPhoneConfirm"
          >查看联系方式</wd-button>
        </view>
      </view>
      
      <!-- 开始约会按钮 -->
      <view class="btn-full w-center pt-22rpx" v-if="!loveDetail.registered && loveDetail.status == 0">
        <wd-button 
          class="btn-w-full btn-h-78"
          :loading="registerLoading"
          @click="submit"
        >去应约</wd-button>
      </view>
    </template>
    
    <view class="w-full h-120rpx"></view>
    
    <!-- 协议 -->
    <!-- <view class="mt-10rpx flex-center">
      <wd-checkbox v-model="checked">
        <wd-text text="我已阅读并同意" size="24rpx" color="#5A5A5A"></wd-text>
      </wd-checkbox>
      <wd-text text="《会员协议》" @click="toPath('/feature/richtext?code=1')" size="24rpx" color="#165DFF"></wd-text>
    </view> -->
    <wd-message-box selector="wd-message-box-slot" v-if="showRule">
      <view class="">
        <view class="align-l">1、发起约会者和应约者需完善个人资料并实名认证。</view>
        <view class="align-l">2、约会广场为1对1应约模式，发起约会者可在应约者中匹配1名心仪之人“接受邀约”。</view>
        <view class="align-l">3、发起约会者与应约者匹配成功，“接受邀约”后，本次约会成功。</view>
        <view class="align-l">4、截止约会开始前，如发起约会者在应约者中没有匹配到心仪的人，本次约会将自动失效。</view>
        <view class="align-l">5、约会双方对本次约会的安全全权负责。</view>
      </view>
    </wd-message-box>
    
    <wd-overlay :show="showQrCode" @click="showQrCode = false">
      <view class="w-464rpx bg-#fff position-center rounded-24rpx" @click.stop="">
        <view class="w-400rpx h-400rpx m-a !mt-32rpx bg-#f1f1f1 rounded-24rpx font-size-0">
          <wd-img 
            width="400rpx" 
            height="400rpx" 
            :round="false"
            mode="aspectFill"
            :show-menu-by-longpress="true"
            :src="getQrCode" 
          />
        </view>
        <view class="color-#999 font-size-24rpx text-center pb-32rpx pt-24rpx">
          长按识别二维码联系对方
        </view>
      </view>
    </wd-overlay>
    
    <!-- 获取手机号需支付${amount}乐缘币 -->
    <!-- 按1，5.2，9.9，13.14每次循环收费 -->
    <wd-action-sheet 
      v-model="showPhoneSheet" 
      :actions="getActions" 
      cancel-text="取消"
      :title="`按1元/次收费`"
      @select="selectPhonePayMethod"
    />
    
    <!-- 联系方式 -->
    <wd-action-sheet 
      v-model="showContact" 
      :actions="enumParams.contactActions" 
      cancel-text="取消"
      title="请选择要查看的联系方式"
      @select="selectContact"
    />
    
    <!-- 查看联系方式 -->
    <wd-action-sheet 
      custom-class="vip-bg-color"
      v-model="showVip" 
      :actions="enumParams.vipActions" 
      cancel-text="取消"
      title=""
      @select="selectVip"
    />
    
    <wd-action-sheet 
      v-model="showPaySheet" 
      :actions="getActions" 
      cancel-text="取消"
      :title="`应邀需支付${loveDetail.payMoney}乐缘币`"
      @select="selectPayMethod"
    />
    
    <!-- 虚拟通话 -->
    <wd-action-sheet 
      custom-class="vip-bg-color"
      v-model="showPhoneTips" 
      :actions="enumParams.phoneVipActions" 
      cancel-text="取消"
      title=""
      @select="selectPhone"
    />
    
    <!-- 私信 -->
    <wd-action-sheet 
      custom-class="vip-bg-color"
      v-model="showChatTips" 
      :actions="enumParams.chatActions" 
      cancel-text="取消"
      title=""
      @select="selectChat"
    />
  </view>
</template>
  
<script lang="ts" setup>
import MySwiper from "@/components/swiper/my-swiper.vue";
import baseImgBox from "@/components/base/base-img-box.vue";
import { DatingRegistrationInfo, DatingRegistrationInfoDatingWechat, GetDatingInfo, SureDatingApi } from "@/service/db_love";
import { GetBindPhoneUserId } from "@/service/db_user";
import { Love } from "@/service/types/love";
import { useCommonStore, useThemeStore, useUserStore } from "@/store";
import { calculateAge, comUploadFile, formatDate, getActions } from "@/utils";
import { useMessage, useToast } from 'wot-design-uni';
import { tips } from "@/static/base64";
import { enumParams, share } from "@/enum";
import { ReduceBalanceByType } from "@/service/db_index";

// 主题颜色
const { themeConfig } = useThemeStore();
const message = useMessage();
const user = useUserStore();
const toast = useToast();

// 显示支付方式
const showPaySheet = ref(false);

const loveDetailDefault = {
  fileInfoVoList: [{}, {}, {}],
  personAvatar: {},
  userProfileInfoVo: {},
  datingRegistrationInfoVos: [],
} as Love.LoveDetail;
const loveId = ref('');
const loading = ref<boolean>(false);
const loveDetail = ref(loveDetailDefault);
/**
 * 获取约会详情
 */
const getDatingInfo = async () => {
  try {
    loading.value = true;
    const res = await GetDatingInfo({ 
      id: loveId.value,
      userId: user.userInfo.id,
    });
    loading.value = false;
    loveDetail.value = res.data || loveDetailDefault;
    if (!loveDetail.value.userProfileInfoVo) {
      loveDetail.value.userProfileInfoVo = {} as any;
    }
  } catch (error) {
    loading.value = false;
    console.log('error', error)
  }
}

// 参与人列表
const datingRegistrationInfoVos = computed(() => {
  return loveDetail.value.datingRegistrationInfoVos || [];
})

const getInfo = computed(() => {
  return (item) => {
    const userProfileInfoVo = item.userProfileInfoVo || {};
    const userInfoVo = item.userInfoVo || {};
    const personAvatar = userInfoVo.personAvatar || {};
    const { provinceName, cityName, districtName } = userProfileInfoVo;
    let areaList = [provinceName, cityName, districtName];
    if (provinceName && provinceName === cityName) {
      areaList = [cityName, districtName];
    }
    return {
      ...userProfileInfoVo,
      preUrl: personAvatar.preUrl,
      code: userInfoVo.code,
      areaName: areaList.join('·'),
      userId: item.userId,
      status: item.status,
      thumbnailPreUrl: personAvatar.thumbnailPreUrl,
    }
  }
})

const showRule = ref(false);
const ruleMsg = useMessage('wd-message-box-slot');
const submit = () => {
  if (loveDetail.value.userId === user.userInfo.id) {
    toast.show({ msg: '不能参加自己发布的约会！', duration: 3000 });
    return;
  }
  if (!user.getUseVo.userProfileInfoVo.nickname) {
    setTimeout(() => {
      uni.navigateTo({ url: '/activity/info' });
    }, 1000)
    toast.show({ msg: '请先完善个人资料', duration: 3000 });
    return;
  }
  if (!user.activityInfo.id) {
    toast.show({ msg: '请先填写资料', duration: 3000 });
    setTimeout(() => {
      uni.navigateTo({ url: '/activity/addActivityInfo' })
    }, 1000)
    return
  }
  
  showRule.value = true;
  ruleMsg
    .confirm({
      title: '约会须知'
    })
    .then(() => {
      showRule.value = false;
      datingRegistrationInfo();
      // 免费
      // if (loveDetail.value.payMoney === 0) {
      //   datingRegistrationInfo();
      //   return;
      // }
      // showPaySheet.value = true;
    })
    .catch(() => {
      showRule.value = false;
      console.log('点击了取消按钮')
    })
}

/**
 * 应邀请求状态
 */
 const registerLoading = ref<boolean>(false);
 const common = useCommonStore();
/**
 * 应邀
 */
const datingRegistrationInfo = async () => {
  try {
    registerLoading.value = true;
    const data = {
      userId: user.userInfo.id,
      datingId: loveDetail.value.id,
      // payAmount: loveDetail.value.payMoney || 0
      payAmount: 0
    }
    const res = await DatingRegistrationInfo(data);
    registerLoading.value = false;
    if (res.code == '6000012') {
      // common.paymentMsgConfirm({
      //   userId: user.userInfo.id,
      //   type: 'join_dating',
      //   relatedBusinessId: loveDetail.value.id,
      //   amount: loveDetail.value.payMoney
      // }, () => {
      //   // 充值成功
      //   toast.show(res.message);
      //   getDatingInfo();
      // }, false, message)
      return 
    }
    common.refresh.appointmentDetail = true;
    // getPhoneConfirm();
    toast.show({ msg: '已发送邀约', duration: 3000 });
    getDatingInfo();
  } catch (error) {
    registerLoading.value = false;
    console.log('error', error)
  }
}

// 选择支付方式
const selectPayMethod = (options) => {
  const { item } = options || {};
  if (item.type === 'wechat') {
    // const data = {
    //   userId: user.userInfo.id,
    //   datingId: loveDetail.value.id,
    //   payAmount: loveDetail.value.payMoney || 0
    // }
    common.reduceMoney({
      userId: user.userInfo.id,
      datingId: loveDetail.value.id,
      payAmount: loveDetail.value.payMoney || 0

      // userId: user.userInfo.id,
      // type: 'join_dating',
      // amount: loveDetail.value.payMoney,
      // relatedBusinessId: loveDetail.value.id,
      // relatedBusinessInfo: JSON.stringify(data),
    }, () => {
      // getPhoneConfirm();
      common.refresh.appointmentDetail = true;
      // 充值成功
      toast.show({ msg: '已发送邀约', duration: 3000 });
      getDatingInfo();
    }, DatingRegistrationInfoDatingWechat)
  } else {
    datingRegistrationInfo();
  }
}

// 是否vip
const isVip = () => {
  const { matchmakerFlag, membershipFlag, partnerFlag } = user.userInfo || {};
  return matchmakerFlag || membershipFlag || partnerFlag;
}

const showPhoneTips = ref(false);
// 获取虚拟电话
const getBindPhoneUserId = async () => {
  return toast.show('测试中');
  // 虚拟号通话按市话收费
  if (!user.getUseVo.userProfileInfoVo.nickname) {
    setTimeout(() => {
      uni.navigateTo({ url: '/activity/info' });
    }, 1000)
    return toast.show('请先完善个人资料');
  }
  if (!isVip()) {
    showPhoneTips.value = true;
    return;
  }
  phoneConfirm();
}

// 选择虚拟的通话
const selectPhone = (options) => {
  const { item } = options || {};
  if (item.type === 'vip') {
    uni.navigateTo({ url: '/feature/vip' });
  } else {
    // phoneConfirm();
    getBindPhoneUserIdApi();
  }
}

// 虚拟通话弹窗提示
const phoneConfirm = () => {
  message
    .confirm({
      msg: '虚拟通话每分钟0.12个乐缘币，\n充值更优惠',
      title: '通话收费提示'
    })
    .then(async() => {
      getBindPhoneUserIdApi();
    })
    .catch(() => {
      console.log('点击了取消按钮')
    })
}

// 获取虚拟电话
const getBindPhoneUserIdApi = async () => {
  try {
    const res = await GetBindPhoneUserId({
      userIdA: user.userInfo.id,
      userIdB: loveDetail.value.userId
    })
    if (res.code == '6000012') {
      // common.paymentMsgConfirm({
      //   userId: user.userInfo.id,
      //   amount: 1,
      // }, () => {
      //   makeCall(res.data);
      // }, true, message)
      return 
    }
    makeCall(res.data);
  } catch (error) {
    console.log(error)
  }
}

// 拨打电话
const makeCall = (phoneNumber = '') => {
  uni.makePhoneCall({
    phoneNumber,
    success: (success) => {
      console.log(success)
    }
  })
}

const showChatTips = ref(false);
// 选择去私信
const selectChat = (options) => {
  const { item } = options || {};
  if (item.type === 'vip') {
    uni.navigateTo({ url: '/feature/vip' });
  } else {
    toChat();
  }
}

// 私聊
const openConversationList = () => {
  // return toast.show('功能调试中');
  if (!user.getUseVo.userProfileInfoVo.nickname) {
    setTimeout(() => {
      uni.navigateTo({ url: '/activity/info' });
    }, 1000)
    return toast.show('请先完善个人资料');
  }
  
  // 1v1 chat: conversationID = `C2C${userID}`
  // group chat: conversationID = `GROUP${groupID}`
  // const conversationID = 'C2C' + loveDetail.value.userId;
  // uni.navigateTo({
  //   url: `/TUIKit/components/TUIChat/index?conversationID=${conversationID}`
  // });
  
  if (!isVip()) {
    showChatTips.value = true;
    return;
  }

  toChat();
}

// 发布者确认应邀提示
const sureDatingConfirm = (userId: any) => {
  message
    .confirm({
      msg: '确认要接受邀约吗？',
      title: '提示'
    })
    .then(async() => {
      sureDating(userId);
    })
    .catch(() => {
      console.log('点击了取消按钮')
    })
}

const sureDatingLoading = ref(false);
// 发布者确认应邀
const sureDating = async (userId: any) => {
  try {
    sureDatingLoading.value = true;
    await SureDatingApi({
      datingUserId: loveDetail.value.userId,
      userId,
      datingId: loveDetail.value.id,
    });
    toast.show('预约成功!');
    getDatingInfo();
    sureDatingLoading.value = false;
  } catch (error) {
    sureDatingLoading.value = false;
    console.log(error);
  }
}

const userDetail = computed((): any => {
  return loveDetail.value.userProfileInfoVo || {};
})

// 获取手机号弹窗提示
const getPhoneConfirm = () => {
  // 如果不是红娘，需要完善信息
  // && !user.userInfo.matchmakerFlag
  if (!user.getUseVo.userProfileInfoVo.nickname) {
    setTimeout(() => {
      uni.navigateTo({ url: '/activity/info' });
    }, 1000)
    return toast.show('请先完善个人资料');
  }
  if (loveDetail.value.hiddenPhone) {
    message.alert({
      title: '该会员需通过“私信”或“虚拟号通话”或“客服”联系对方'
    })
    return
  }

  const { showPhone, showWechat } = userDetail.value || {};
  if (showPhone && showWechat) {
    showContact.value = true;
  } else if (showWechat) {
    contactType.value = 'showWechat';
    // getContact();
    hasVip();
  } else {
    contactType.value = 'showPhone';
    // getContact();
    hasVip();
  }
}

const showPhoneSheet = ref(false);
// 选择支付方式
const selectPhonePayMethod = (options) => {
  const { item } = options || {};
  if (item.type === 'wechat') {
    common.paymentMsgConfirm({
      userId: user.userInfo.id,
      type: 'getPhone',
    }, () => {
      // 充值成功
      getContact();
    }, false, message, true)
  } else {
    getPhone();
  }
}

// 获取手机号
const getPhone = async () => {
  try {
    const res = await ReduceBalanceByType({
      userId: user.userInfo.id,
      type: 'getPhone'
    })
    if (res.code == '6000012') return;
    getContact();
  } catch (error) {
    console.log(error)
  }
}

// 判断是否为vip，是vip直接弹出支付
const hasVip = () => {
  if (isVip()) {
    showPhoneSheet.value = true;
  } else {
    showVip.value = true;
  }
}

const showContact = ref(false);
const contactType = ref('showPhone');
// 选择联系方式
const selectContact = (options) => {
  const { item } = options || {};
  contactType.value = item.type;
  showContact.value = false;
  // getContact();
  hasVip();
}

const showQrCode = ref(false);
const getQrCode = computed(() => {
  const _wechatQrCodeFile = userDetail.value.wechatQrCodeFile || {} as any;
  return _wechatQrCodeFile.preUrl || '';
})

// 获取联系方式
const getContact = () => {
  if (contactType.value === 'showWechat') {
    showQrCode.value = true;
  } else {
    makeCall(loveDetail.value.phone);
  }
}

const showVip = ref(false);
// 选择vip
const selectVip = (options) => {
  const { item } = options || {};
  if (item.type === 'vip') {
    uni.navigateTo({ url: '/feature/vip' });
  } else {
    // showPaySheet.value = true;
    showPhoneSheet.value = true;
  }
}

// 跳转私信
const toChat = () => {
  uni.navigateTo({
    url: `chatRoom?conversationID=${loveDetail.value.userId}`
  });
}

// 跳转用户详情
const toUserDetail = (id: any) => {
  if (!user.isLogined) {
    uni.navigateTo({ url: '/pages/login/index' });
    return
  }
  uni.navigateTo({ 
    url: `/activity/userDetail?id=${id}`
  })
}

onLoad((options) => {
  const { id } = options || {};
  loveId.value = id;
  getDatingInfo();
})

onShow(() => {
  nextTick(() => {
    // 设置页面标题
    themeConfig.title = '约会详情';
  })
})

onShareAppMessage(() => {
  const id = user.userInfo.id || '';
  const sharePhotoFile = loveDetail.value.sharePhotoFile || {};
  // const list = loveDetail.value.fileInfoVoList || [];
  // const first: any = list[0] || {};
  
  return {
    title: '约会吧，让心灵从此不再孤单！',
    path: `/activity/appointmentDetail?id=${loveId.value || ''}` + '&instrId=' + id,
    imageUrl: sharePhotoFile.preUrl || share,
  }
})
</script>

<style lang="scss" scoped>
.align-l {
  text-align: left;
}

// 轮播图高度
:deep(.wd-swiper__track) {
  height: 637rpx !important;
}

:deep(.wd-checkbox) {
  .wd-checkbox__shape {
    border-width: 1px;
    width: 30rpx !important;
    height: 30rpx !important;
  }
  .wd-checkbox__label {
    margin-left: 10rpx;
  }
}

:deep(.wd-notice-bar) {
  padding-right: 0 !important;
}

:deep(.wd-action-sheet__action) {
  padding-left: 4rpx;
  padding-right: 4rpx;
  height: auto !important;

  .wd-action-sheet__name {
    line-height: 48rpx;
    white-space: pre-wrap;
  }
}
</style>
    